import { queryBasicProfile, queryExamine } from '../services/applyDetails';

const Model = {
  namespace: 'doggyAndTodoListAndApplyAndDetails',
  state: {
    data: {
      details: [],
      visit: false,
    },
  },
  effects: {
    *fetchBasic(_, { call, put }) {
      const { payload } = _;
      const response = yield call(queryBasicProfile, payload);
      yield put({
        type: 'show',
        payload: response,
      });
    },
    *fetchExamine(_, { call, put }) {
      const { payload } = _;
      const response = yield call(queryExamine, payload);
    },
    *visible(_, { call, put }) {
      const { payload } = _;
      yield put({
        type: 'modalVisit',
        payload: payload,
      });
    },
  },
  reducers: {
    show(state, { payload }) {
      return { ...state, ...payload };
    },
    modalVisit(state, { payload: visit }) {
      return { ...state, visit };
    },
  },
};
export default Model;
